home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windows News 2010 Summer - Disc 1
/
WN_Ete2010_CD1.iso
/
Onglet5
/
Weezo
/
Weezo setup.exe
/
{code_appDir}
/
www
/
local
/
serverManagement.php
< prev
next >
Wrap
PHP Script
|
2010-05-19
|
4KB
|
151 lines
<?php
/**
* Process commands sent by weezo application
*
* PHP version 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category NA
* @package NA
* @author Nicolas Bruley / Peer 2 World <contact@weezo.net>
* @copyright 2005-2009 Nicolas Bruley / Peer 2 World
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id:$
* @link http://www.weezo.net
* @since File available since Release 1.0.5
*/
ignore_user_abort(true);
// Initialize script data
require_once('localFunctions.php');
require_once(INCLUDE_DIR.'initFunctions.php');
/**
* Clear general.ini and languages data into server memory
*/
if(isset($_GET['resetConfig'])){
@cfMUnsetVar('weezoGeneral');
ifInitializeServer();
}
/**
* Clear general.ini and languages data into server memory
*/
if(isset($_GET['resetGeneral'])){
@cfMUnsetVar('weezoGeneral');
ifLoadGeneral();
}
/**
* Set mailslot index, used for mailslot communication with application
*/
if(isset($_GET['setMailslotIndex']) && is_numeric($_GET['setMailslotIndex'])) cfMSetVar('mailslotIndex',$_GET['setMailslotIndex']);
/**
* Set external IP address
*/
if(isset($_GET['setExternalIP'])) cfGUpdateVar('externalIP',$_GET['setExternalIP'],'serverOnly');
/**
* Ban IP address
*/
if(isset($_GET['banIP'])) {
}
/**
* Reset (only) user data into server memory
*/
if(isset($_GET['resetUsers'])){ifLoadUsers();}
/**
* Reset (only) resources data into server memory
*/
if(isset($_GET['resetResources'])){
if(isset($_GET['resourceFile'])) {
ifLoadResource($_GET['resourceFile']);
// Indicate UI resource tab web interface to focus on this resource at next reload
cfGUpdateVar("uiResourceSelected",$_GET['resourceFile']);
}
else ifLoadResources();
}
/**
* Reset resources definition
*/
if(isset($_GET['resetResourcesDefinition'])){ifResourcesDefinitions();}
/**
* Reset all logged users from actually existing / associated resources
*/
if(isset($_GET['resetLoggedUsersResources'])){
ifResetResourcesUsers(false && isset($_GET['resetUsers']),false && isset($_GET['resetResources']));
}
/**
* Clear in-memory and files sessions
*/
if(isset($_GET['destroySession']) && substr($_GET['destroySession'],0,5)=='sess_'){
@cfMUnsetVar($_GET['destroySession']);
@unlink(cfAppDataDir().'/sessiondata/'.$_GET['destroySession']);
}
/**
* Update weezo.net account registration information
*/
if(isset($_GET['updateRegInfo'])) ifLoadRegInfo();
// Start bittorrent seeder
if(isset($_GET['bittorrentStart'])){
$handle=cfSocketHTTPRequest(cfGGetVar('protocol').'://127.0.0.1:'.cfGGetVar('serverPort').'/bittorrentSeeder.php?action=start',7,false,$err,$curl,false,true);
if(!$handle) return false;
usleep(10000);
fclose($handle);
}
// Set key used for IU scripts access
if(isset($_GET['setWeezoKey']) && $_SERVER['REMOTE_ADDR']=='127.0.0.1') {
customSetKey($_GET['setWeezoKey']);
echo 'key set';
}
// Set password key
if(isset($_GET['setPwdKey'])) cfMSetVar('weezoPwdKey',base64_decode($_GET['setPwdKey']));
/**
* Set server state ('web' or 'lan')
*/
if(isset($_GET['serverState']) && ($_GET['serverState']=='web' || $_GET['serverState']=='lan'))
cfMSetVar('weezoServerState',$_GET['serverState']);
/**
* Server shuting down: log event
*/
if(isset($_GET['serverShutdown'])){
cfLogEvent(cfCaption('activityWeezoStop',false,false,false,true),EVENT_SERVERSTATE,S_EVENT_OFF);
}
/**
* Server starting (on web) for the 1st time since app launched: log
*/
if(isset($_GET['logStartEvent'])){
// Monitor event
if(cfIsRegistered()) {
$regInfo=cfMGetVar('weezoRegInfo');
$logCaption=cfCaption('apacheStartedWeb',false,false,false,true).cfCaption('genSeparator').DNS_SITE.'/'.$regInfo['regName'];
}
else $logCaption=cfCaption('apacheStartedWeb',false,false,false,true).cfCaption('genSeparator');
cfLogEvent($logCaption,EVENT_SERVERSTATE,((cfMGetVar('weezoServerState')=='web' || (@$_GET['serverState']=='web'))?S_EVENT_WEB:S_EVENT_LAN));
}
?>